﻿<%@ Page Language="C#" MasterPageFile="~/TownshipEnterprise/Town.master" StylesheetTheme="Content"  AutoEventWireup="true" CodeFile="SoldierList.aspx.cs" Inherits="TownshipEnterprise_SoldierList" Title="无标题页" %>

<%@ Register src="../UserContral/ListPageContral.ascx" tagname="ListPageContral" tagprefix="uc1" %>
 

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script type="text/javascript">
        //<![CDATA][
        function CheckAll(oCheckbox) {
            var items = document.getElementsByTagName("INPUT");
            for (i = 0; i < items.length; i++) {
                if (items[i].type == "checkbox") {
                    items[i].checked = oCheckbox.checked;
                }
            }
        }
        function OpenWin(url) {
            var h = 480;
            var w = 640;
            var t = (screen.height - h) / 2;
            var l = (screen.width - w) / 2;
            window.open(url, null, 'left=' + l + ",top=" + t + ",width=" + w + ",height=" + h + ",toolbar=yes,scrollbars=yes,status=yes");
        }
        //]]>
    </script>
 <asp:Panel runat="server" ID="top">
    <ul class="topmenu">
        <li>单位：
            <asp:DropDownList ID="DepartmentList" runat="server" AutoPostBack="True" DataTextField="ShortName"
                DataValueField="DepartmentID" OnTextChanged="DepartmentList_TextChanged" 
                AppendDataBoundItems="True">
                <asp:ListItem Value="" Text="--单位--"></asp:ListItem>
            </asp:DropDownList>
            <asp:DropDownList ID="UnitList" runat="server" DataTextField="ShortName" DataValueField="DepartmentID"
                AppendDataBoundItems="True" AutoPostBack="True" 
                OnSelectedIndexChanged="UnitList_SelectedIndexChanged">
            </asp:DropDownList>
            <asp:DropDownList ID="DeviceTypeList" runat="server" AutoPostBack="True" 
                OnSelectedIndexChanged="DeviceTypeList_SelectedIndexChanged" 
                AppendDataBoundItems="True" Visible="False">
                <asp:ListItem Text="--类型--" Value=""></asp:ListItem>
            </asp:DropDownList>
            <asp:DropDownList ID="DeviceClassList" runat="server" 
                AppendDataBoundItems="true" AutoPostBack="True" 
                OnSelectedIndexChanged="DeviceClassList_SelectedIndexChanged" Visible="False">
            </asp:DropDownList>
        </li>
    </ul>
    <ul class="topmenu">
        <li><a href="SoldierAdd.aspx">添加</a></li>
        <li>
            <asp:LinkButton ID="ButtonEdit" runat="server" OnClick="ButtonEdit_Click">编辑</asp:LinkButton></li>
        <li>
            <asp:LinkButton ID="ButtonDelete" runat="server" OnClick="ButtonDelete_Click">删除</asp:LinkButton></li>
        <li>
            <asp:LinkButton ID="ButtonAttachment" runat="server" 
                OnClick="ButtonAttachment_Click" Visible="False">附件管理</asp:LinkButton></li>
        <li>
            <asp:LinkButton ID="ButtonLog" runat="server" OnClick="ButtonLog_Click" 
                Visible="False">操作记录</asp:LinkButton></li>
    </ul>
      </asp:Panel>
    <asp:GridView ID="UserGrid" runat="server" AutoGenerateColumns="False" Caption="<span>士兵信息列表</span>"
        DataKeyNames="SoldierID" OnRowDataBound="UserGrid_RowDataBound">
        <Columns>
            <asp:TemplateField>
                <HeaderTemplate>
                    <input id="ChkAll" type="checkbox" onclick="CheckAll(this)" runat="server" title="全选/取消" />
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:CheckBox ID="CheckItem" runat="server" />
                </ItemTemplate>
                <HeaderStyle Width="20px" />
                <ItemStyle HorizontalAlign="Center" />
            </asp:TemplateField>
            <asp:TemplateField>
                <ItemStyle HorizontalAlign="Center" />
                <HeaderStyle Width="30px" />
                <ItemTemplate>
                    <asp:Label ID="ID" runat="server"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="姓名">
                <ItemTemplate>
                    <a href="javascript:OpenWin('SoldierView.aspx?ID=<%# Eval("SoldierID") %>');">
                        <%# Eval("SoldierName")%></a>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="编号">
                <ItemTemplate>
                    <%# Eval("CardID")%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="警衔">
                <ItemTemplate>
                    <%# GetRank(Eval("Rank"))%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="单位">
                <ItemTemplate>
                    <%# GetDepartmentName(Eval("TownBasicID").ToString())%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="籍贯">
                <ItemTemplate>
                    <%# GetNative(Eval("Native"))%>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="入伍时间">
                <ItemTemplate>
                    <%# GetJoinTime(Eval("JoinTime"))%>
                </ItemTemplate>
            </asp:TemplateField>
            <%--<asp:TemplateField HeaderText="最后更新时间">
                <ItemTemplate>
                    <%# Eval("TimeLastModified") %>
                </ItemTemplate>
            </asp:TemplateField>--%>
        </Columns>
        <HeaderStyle HorizontalAlign="Left" />
    </asp:GridView>
    <div style="padding: 4px;">
        <div style="float: left">
            <asp:Label ID="lbGridInfo" runat="server"></asp:Label>
        </div>
        <uc1:ListPageContral ID="ListPageContral1" PageSize="20" runat="server" OnPageSizeChange="ListPageContral1_PageSizeChange" />
    </div>
   
    <div class="prompt">
        <asp:Label ID="Prompt" runat="server"></asp:Label></div>
</asp:Content>

